home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / Timing / UpTime17.lha / UpTime / Install_UpTime < prev    next >
Encoding:
Text File  |  1993-10-19  |  7.0 KB  |  262 lines

  1. ;
  2. ;   $VER: Install_UpTime 1.6 (19.10.93)
  3. ;
  4. ;   Written 12. September 1993 by J.Matern
  5. ;   This file is part of the 'UpTime'-package © by Jürgen Matern.
  6. ;   The package may be redistributed under limitations discribed
  7. ;   in the file 'UpTime.doc' which should have come with this
  8. ;   distribution. Read this file for more information!
  9. ;
  10. ;   Last changed: 19. October 1993
  11. ;
  12.  
  13. failat 21
  14.  
  15. path install add
  16. path scripts add
  17. type Install/UpTime.txt
  18.  
  19. echo " Start installation-script (y/n)? " noline
  20. set > nil: yesno ?
  21. if $yesno not eq y
  22.    skip abort
  23. endif
  24.  
  25. echo "*N Please enter the directory, where the UpTime-package shall keep it's files."
  26. echo " If it doesn't exist it will be created: " noline
  27.  
  28. set > nil: dest ?
  29. if $dest eq ""
  30.    skip abort
  31. endif
  32. if $dest eq "*$dest"
  33.    skip abort
  34. endif
  35.  
  36. echo "*N Checking destination directory ..."
  37.  
  38. CheckDir "$dest" ask
  39. if val $retcode eq 5
  40.    skip abort
  41. endif
  42.  
  43. set dest `AddSlash "$dest"`
  44. set subdir scripts
  45. CheckDir "$dest$subdir"
  46. if val $retcode eq 5
  47.    skip abort
  48. endif
  49.  
  50. set date `date`
  51. set year `ExtractYear $date`
  52. unset date
  53.  
  54. set defup UpTime.
  55. echo "*N Please enter the UpTimeBaseName. The package will create a full filename"
  56. echo " with path and suffix (actual year). If you enter 'UpTime' the resulting"
  57. echo " filename  will be: '$dest$defup$year'. In this file"
  58. echo " you will find the times your computer was working, sorted by day."
  59. echo "*N Enter UpTimeBaseName now: " noline
  60.  
  61. set > nil: upbase ?
  62. if $upbase eq ""
  63.    skip abort
  64. endif
  65. if $upbase eq "*$upbase"
  66.    skip abort
  67. endif
  68.  
  69. set deflog LogFile.
  70. echo "*N Please enter the LogBaseName. The package will create a full filename"
  71. echo " with path and suffix (actual year). If you enter 'LogFile' the resulting"
  72. echo " filename  will be: '$dest$deflog$year'. In this file"
  73. echo " you will find a note every time your computer booted."
  74. echo "*N Enter LogBaseName now: " noline
  75.  
  76. set > nil: logbase ?
  77. if $logbase eq ""
  78.    skip abort
  79. endif
  80. if $logbase eq "*$logbase"
  81.    skip abort
  82. endif
  83.  
  84. set defonoff OnOff.
  85. echo "*N Please enter the OnOffBaseName. The package will create a full filename"
  86. echo " with path and suffix (actual year). If you enter 'OnOff' the resulting"
  87. echo " filename  will be: '$dest$defonoff$year'. In this file you"
  88. echo " will find a note when you switched your computer on, when you turned it"
  89. echo " off, and how many resets you had inbetween."
  90. echo "*N Enter OnOffBaseName now: " noline
  91.  
  92. set > nil: onoffbase ?
  93. if $onoffbase eq ""
  94.    skip abort
  95. endif
  96. if $onoffbase eq "*$onoffbase"
  97.    skip abort
  98. endif
  99.  
  100. echo "*N Please enter the translation of 'yesterday', if your system is localized,"
  101. echo " otherwise enter 'yesterday': " noline
  102.  
  103. set > nil: yesterday ?
  104. if $yesterday eq ""
  105.    skip abort
  106. endif
  107. if $yesterday eq "*$yesterday"
  108.    skip abort
  109. endif
  110.  
  111. echo "*N Please enter the translation of 'tomorrow', if your system is localized,"
  112. echo " otherwise enter 'tomorrow': " noline
  113.  
  114. set > nil: tomorrow ?
  115. if $tomorrow eq ""
  116.    skip abort
  117. endif
  118. if $tomorrow eq "*$tomorrow"
  119.    skip abort
  120. endif
  121.  
  122. echo "*N Setting up the UpTime-environment..."
  123.  
  124. CheckDir ENV:UpTime
  125. if val $retcode eq 5
  126.    skip abort
  127. endif
  128.  
  129. CheckDir ENVARC:UpTime
  130. if val $retcode eq 5
  131.    skip abort
  132. endif
  133.  
  134. setenv UpTime/yesterday $yesterday
  135. setenv UpTime/tomorrow $tomorrow
  136. setenv UpTime/UpBaseName "$dest$upbase"
  137. setenv UpTime/LogBaseName "$dest$logbase"
  138. setenv UpTime/OnOffBaseName "$dest$onoffbase"
  139. copy ENV:UpTime/yesterday ENVARC:UpTime/yesterday
  140. copy ENV:UpTime/tomorrow ENVARC:UpTime/tomorrow
  141. copy ENV:UpTime/UpBaseName ENVARC:UpTime/UpBaseName
  142. copy ENV:UpTime/LogBaseName ENVARC:UpTime/LogBaseName
  143. copy ENV:UpTime/OnOffBaseName ENVARC:UpTime/OnOffBaseName
  144.  
  145. echo "*N Creating filenames for logfiles ..."
  146. NewFileNames
  147.  
  148. echo "*N Copying scripts to '$dest$subdir' ... *N"
  149. copy scripts/#? "$dest$subdir" clone
  150.  
  151. if exists s:user-startup
  152.    echo "*N Copying your file 's:user-startup' to 's:user-startup.backup' ..."
  153.    copy s:user-startup s:user-startup.backup clone
  154. else
  155.    echo "*N Couldn't find file 's:user-startup', can't continue installation!"
  156.    skip abort
  157. endif
  158.  
  159. echo "*N Modifying file 's:user-startup' ..."
  160. echo >> s:user-startup ";BEGIN UPTIME"
  161. echo >> s:user-startup "   assign S: *"$dest$subdir*" add"
  162.  
  163. search > nil: s:startup-sequence "#?resident#? execute #?execute#?" pattern
  164. if warn
  165.    echo >> s:user-startup "   resident > nil: execute c:execute pure"
  166. else
  167.    search > Pipe:UpTime_Install_Pipe s:startup-sequence "#?resident#? execute #?remove" pattern
  168.    if not warn
  169.       echo "*N If you want to speed up execution of your scripts then remove"
  170.       echo " the following line in the file 's:startup-sequence':"
  171.       type Pipe:UpTime_Install_Pipe
  172.       echo "    ^   ^"
  173.       echo "    |   |"
  174.       echo "    |   +-- The line itself"
  175.       echo "    +------ Line number "
  176.    endif
  177. endif
  178.  
  179. echo >> s:user-startup "   resident > nil: eval c:eval pure"
  180. echo >> s:user-startup "   execute > nil: < nil: S:CheckBootDate"
  181. echo >> s:user-startup ";END UPTIME"
  182.  
  183. echo "*N Have you already installed a cron-utility (y/n)? " noline
  184. set > nil: yesno ?
  185. if $yesno eq y
  186.    skip cronyes
  187. endif
  188. skip incomplete
  189.  
  190. lab cronyes
  191. echo "*N Have you installed the CyberCron-utility (y/n)? " noline
  192. set > nil: yesno ?
  193. if $yesno eq n
  194.    skip nocybercron
  195. endif
  196.  
  197. echo "*N Shall I add the UpTime-CronTab to your personal CronTab-file (y/n)? " noline
  198. set > nil: yesno ?
  199. if $yesno eq n
  200.    skip nocybercron
  201. endif
  202.  
  203. echo "*N Enter filename (with full path)"
  204. echo " of your CronTab-file: " noline
  205. set > nil: crontab ?
  206.  
  207. if $crontab eq ""
  208.    skip abort
  209. endif
  210. if $crontab eq "*$crontab"
  211.    skip abort
  212. endif
  213.  
  214. if not exists "$crontab"
  215.    echo "*N Couldn't find your CronTab-file!"
  216.    skip nocybercron
  217. endif
  218.  
  219. echo > T:Install_UpTime "$dest$subdir" noline
  220. join $crontab s/CronTab.part1 T:Install_UpTime s/CronTab.part2 AS T:CronTab
  221. echo > T:Install_UpTime "$dest$subdir" noline
  222. join T:CronTab T:Install_UpTime s/CronTab.part3 AS $crontab
  223. delete > nil: T:CronTab
  224. delete > nil: T:Install_UpTime
  225. skip modifyuser
  226.  
  227. lab nocybercron
  228. echo "*N Installation incomplete!*N"
  229. echo " You have to reconfigure your personal cron-environment!"
  230. echo " Your cron has to run the script '$dest$subdir/IncreaseUpTime'"
  231. echo " every ten minutes, and the script '$dest$subdir/AtMidNite'"
  232. echo " every midnight. Also see the CronTab-file of this "
  233. echo " distribution (in s-subdir) for more information!"
  234. set incomplete yes
  235. skip modifyuser
  236.  
  237. lab incomplete
  238. echo "*N Installation incomplete!*N"
  239. echo " You have to configure a cron-environment! Perhaps you try 'CyberCron'"
  240. echo " (see in the documentation for more information on 'CyberCron')."
  241. echo " Your cron has to run the script '$dest$subdir/IncreaseUpTime'"
  242. echo " every ten minutes, and the script '$dest$subdir/AtMidNite'"
  243. echo " every midnight. Also see the CronTab-file of this "
  244. echo " distribution (in s-subdir) for more information!"
  245. set incomplete yes
  246. skip modifyuser
  247.  
  248. lab abort
  249. echo "*N Installation aborted.*N"
  250. set incomplete yes
  251. skip modifyuser
  252.  
  253. lab modifyuser
  254. if $incomplete not eq yes
  255.    echo "*N Installation complete. Reboot your system!"
  256. endif
  257.  
  258. path install remove
  259. path scripts remove
  260. echo "*N Press <RETURN> to quit!" noline
  261. set > nil: dummy ?
  262.